//
//  AddressTableViewCell.m
//  JackDeve
//
//  Created by apple on 17/5/15.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "AddressTableViewCell.h"
@interface AddressTableViewCell ()
@property (nonatomic, strong) UILabel *addressLbl;
@property (nonatomic, strong) UILabel *nameLbl;
@property (nonatomic, strong) UILabel *sexLbl;
@property (nonatomic, strong) UILabel *phoneLbl;
@end
@implementation AddressTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier  {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.addressLbl];
        [self.contentView addSubview:self.nameLbl];
        [self.contentView addSubview:self.sexLbl];
        [self.contentView addSubview:self.phoneLbl];
        [self layoutViews];
    }
    return self;
}

- (void)layoutViews {
    _addressLbl.sd_layout
    .topSpaceToView(self.contentView,15)
    .leftSpaceToView(self.contentView,20)
    .widthIs(SCREEN_WIDTH / 10 * 7)
    .autoHeightRatio(0);
   
    _nameLbl.sd_layout
    .topSpaceToView(_addressLbl,10)
    .leftSpaceToView(self.contentView,20)
    .widthIs(50)
    .autoHeightRatio(0);
    
    _sexLbl.sd_layout
    .topSpaceToView(_addressLbl,10)
    .leftSpaceToView(_nameLbl,20)
    .widthIs(30 + 10)
    .autoHeightRatio(0);
    
    _phoneLbl.sd_layout
    .topSpaceToView(_addressLbl,10)
    .leftSpaceToView(_sexLbl,30)
    .widthIs(100 + 10)
    .autoHeightRatio(0);
    
    [self setupAutoHeightWithBottomView:_nameLbl bottomMargin:10];
}

- (void)setModel:(AddData *)model {
    _model = model;
    _addressLbl.text = [NSString stringWithFormat:@"%@%@",model.property_name,model.address];
    _nameLbl.text    = model.consignee;
    if ([model.sex isEqualToString:@"1"]) {
        _sexLbl.text = @"男";
    } else {
        _sexLbl.text = @"女";
    }
    _phoneLbl.text   = model.tel;

}
#pragma mark - 懒加载
- (UILabel *)addressLbl {
    if (!_addressLbl) {
        _addressLbl = [[UILabel alloc] init];
        _addressLbl.font = [UIFont systemFontOfSize:15];
    }
    return _addressLbl;
}

- (UILabel *)nameLbl {
    if (!_nameLbl) {
        _nameLbl           = [[UILabel alloc] init];
        _nameLbl.textColor = [UIColor colorWithRed:(67/255.0) green:(67/255.0) blue:(67/255.0) alpha:1];
        _nameLbl.font = [UIFont systemFontOfSize:15];
    }
    return _nameLbl;
}

- (UILabel *)sexLbl {
    if (!_sexLbl) {
        _sexLbl           = [[UILabel alloc] init];
        _sexLbl.textColor = [UIColor colorWithRed:(67/255.0) green:(67/255.0) blue:(67/255.0) alpha:1];
        _sexLbl.font = [UIFont systemFontOfSize:15];
    }
    return _sexLbl;
}

- (UILabel *)phoneLbl {
    if (!_phoneLbl) {
        _phoneLbl           = [[UILabel alloc] init];
        _phoneLbl.textColor = [UIColor colorWithRed:(67/255.0) green:(67/255.0) blue:(67/255.0) alpha:1];
        _phoneLbl.font = [UIFont systemFontOfSize:15];
    }
    return _phoneLbl;
}


@end
